﻿namespace WFBot.Data.Configuration
{
    using Framework.Domain;
    using Microsoft.Data.Objects;

    public class VisitorConfiguration : EntityConfiguration<Visitor>
    {
        public VisitorConfiguration()
        {
            HasKey(v => v.Id);

            Property(v => v.Id).IsIdentity();
            Property(v => v.Identifier).IsRequired().HasMaxLength(255);
            Property(v => v.IPAddress).IsNotUnicode().HasMaxLength(15);
            Property(v => v.SessionId).IsNotUnicode().HasMaxLength(24);
            Property(v => v.EMail).IsNotUnicode();
            Property(v => v.RegistrationDate);

            MapSingleType(v => new
            {
                v.Id,
                v.Identifier,
                v.IPAddress,
                v.SessionId,
                v.EMail,
                v.RegistrationDate
            }).ToTable("Visitors");
        }
    }
}
